from task import task_1, task_2
import numpy as np
import logging
if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO, format='%(filename)s:%(lineno)s-%(levelname)s:\t%(message)s')
    T = 100
    print(f"run task1 in {T} times")
    task_1_results = [[],[],[]]
    for t in range(T):
        logging.info(f"step {t}")
        rmse0,rmse5,rmse10 = task_1()
        task_1_results[0].append(rmse0)
        task_1_results[1].append(rmse5)
        task_1_results[2].append(rmse10)
    
    print(f"run task2 in {1} times")
    task_2_results = [task_2()]
    
    task_1_results = np.array(task_1_results)
    task_2_results = np.array(task_2_results)
    
    print(f"task_1:      rmse0, rmse5, rmse10:")
    print(f"task_1_min:  {np.min(task_1_results, axis=1)}")
    print(f"task_1_max:  {np.max(task_1_results, axis=1)}")
    print(f"task_1_mean: {np.mean(task_1_results, axis=1)}")
    print(f"task_1_var:  {np.var(task_1_results, axis=1)}")
    print(f"task_2:      rmse:")
    print(f"task_2_min:  {np.min(task_2_results)}")
    print(f"task_2_max:  {np.max(task_2_results)}")
    print(f"task_2_mean: {np.mean(task_2_results)}")
    print(f"task_2_var:  {np.var(task_2_results)}")